export class ModalController {
  visible = false;
  _resolve?: (value?: any) => void;
  _reject?: (reason?: any) => void;
  _vm: any;

  constructor(vm: any) {
    this._vm = vm;
  }

  request(visible: boolean): Promise<any> {
    this.visible = visible;
    const that = this;
    return new Promise(function (resolve, reject) {
      that._resolve = resolve;
      that._reject = reject;
    });
  }

  resolve(value?: any) {
    if (this._resolve) {
      this._resolve(value);
    }
  }

  reject(reason?: any) {
    if (this._reject) {
      this._reject(reason);
    }
  }
}
